package com.yw.smartcityforjava.adapter;

import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

public class  MyBannerAdapter extends BannerAdapter<Integer, RecyclerView.ViewHolder> {

    public MyBannerAdapter(List<Integer> datas) {
        super(datas);
    }

    @Override
    public RecyclerView.ViewHolder onCreateHolder(ViewGroup viewGroup, int i) {

        ImageView imageView = new ImageView(viewGroup.getContext());
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        imageView.setLayoutParams(layoutParams);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        return new RecyclerView.ViewHolder(imageView) {
            @Override
            public String toString() {
                return super.toString();
            }
        };
    }

    @Override
    public void onBindView(RecyclerView.ViewHolder viewHolder, Integer integer, int i, int i1) {
        Glide.with(viewHolder.itemView.getContext()).load(integer).into((ImageView) viewHolder.itemView);
    }

    class MyViewHolder extends RecyclerView.ViewHolder{

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
        }
    }




}
